package top.continew.admin.controller.qywx;

import cn.shengchao.examstar.rpc.wecom.api.RuleEngineApi;
import cn.shengchao.examstar.rpc.wecom.dto.RuleDict;
import cn.shengchao.examstar.rpc.wecom.dto.RuleMatchValueDict;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.continew.starter.web.model.R;

/**
 * @program: examstar-manger-api
 * @description: 规则引擎的基础支撑
 * @author: Xiong weiqiang
 * @create: 2025-04-12 17:48
 */
@Tag(name = "企微-规则引擎的基础支撑")
@RestController
@RequestMapping("/qywx/ruleSupport")
public class RuleSupportController {
    @DubboReference
    RuleEngineApi ruleEngineApi;
    @RequestMapping("/getActionTypeList")
    public R<RuleDict> getActionTypeList(){
        return R.ok(ruleEngineApi.getActionTypeList());
    }
    @RequestMapping("/getConditionList/{conditionType}")
    public R<RuleDict> getConditionList(@PathVariable("conditionType") String conditionType){
        return R.ok(ruleEngineApi.getConditionList(conditionType));
    }
    @RequestMapping("/getValueTypeList")
    public R<RuleDict> getValueTypeList(){
        return R.ok(ruleEngineApi.getValueTypeList());
    }
    @RequestMapping("/getMatchTypeList")
    public R<RuleDict> getMatchTypeList(){
        return R.ok(ruleEngineApi.getMatchTypeList());
    }
    @RequestMapping("/getConditionTypeList")
    public R<RuleDict> getConditionTypeList(){
        return R.ok(ruleEngineApi.getConditionTypeList());
    }

    @RequestMapping("/getConditionMatchValueList")
    public R<RuleMatchValueDict> getConditionMatchValueList(@RequestParam("conditionParamKey") String conditionParamKey){
        return R.ok(ruleEngineApi.getConditionMatchValueListByConditionParamKey(conditionParamKey));
    }

}